<!DOCTYPE html>
<html lang="en" xmlns:th="https://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/js/vue.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css"/>
</head>
<body>
<div>
    <form class="form-horizontal" role="form" id="form_data">
        <div class="form-group">
            <label for="roleid" class="col-sm-2 control-label">角色编号</label>
            <div class="col-sm-4">
                <input type="text" class="form-control" id="roleid" disabled="disabled" th:value="${role.getRoleid()}">
            </div>
        </div>
        <div class="form-group">
            <label for="rolename" class="col-sm-2 control-label">角色名</label>
            <div class="col-sm-4">
                <input type="text" class="form-control" id="rolename" th:value="${role.getRolename()}">
            </div>
        </div>
        <div class="form-group">
            <label for="roleinfo" class="col-sm-2 control-label">角色信息</label>
            <div class="col-sm-4">
                <input type="text" class="form-control" id="roleinfo" th:value="${role.getRoleinfo()}">
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-4">
                <button type="button" class="btn btn-info btn-sm" onclick="updateUser()">修改</button>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">
   function updateUser() {
       var roleid = $('input').eq(0).val();
       var rolename = $('input').eq(1).val();
       var roleinfo = $('input').eq(2).val();
       $.ajax({
           url:"/role/updateUser",
           type:"post",
           data:{
               "roleid":roleid,
               "rolename":rolename,
               "roleinfo":roleinfo
           },
           success:function (data) {
               var msg = data.msg;
               if(msg === "success"){
                   alert("修改成功");
               }
           }
       });
   }
</script>
</body>
</html>